// 定义一个 loading 对象
const myMixin = {
  data() {
    return {
      loadingInstance: null // 用于存储 Loading 实例
    }
  },
  methods: {
    showLoading() {
      this.loadingInstance = this.$loading({
        lock: true,
        text: '加载中',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      })
    },
    hideLoading() {
      if (this.loadingInstance) {
        this.loadingInstance.close()
      }
    }
  }
}
export default myMixin

